"""
Sample connectors.
"""

from zope.interface import implements

from pymx.interfaces import IMonitorConnector



class AccumumateConnector(object):
    """
    A connector that accumulates all notifications in lists. This is mainly
    useful for tests.

    @ivar attributeSets: the list of attribute modifications monitored
    @type attributeSets: C{list}

    @ivar methodCalls: the list of method calls monitored
    @type methodCalls: C{list}
    """
    implements(IMonitorConnector)

    def __init__(self):
        self.attributeSets = []
        self.methodCalls = []


    def attributeSetNotification(self, item, name, value):
        self.attributeSets.append((item, name, value))


    def methodCallNotification(self, item, method, args, kwargs, time):
        self.methodCalls.append((item, method, args, kwargs, time))
